﻿mainModule.controller("cultureSelectionCtrl", ["$scope", "$window", "cultureCacheSvc", "localizationCacheSvc", "$rootScope", function ($scope, $window, cultureCacheSvc, localizationCacheSvc, $rootScope) {
    "use strict";
    $scope.change = function (culture) {                
        localizationCacheSvc.setCulture(culture.Code);
        $window.location.reload();
    }

    $rootScope.$on('staticDataLoaded', function () {
        $scope.cultures = cultureCacheSvc.getAll();
        $scope.curentCulture = _.findWhere($scope.cultures, { Code: localizationCacheSvc.getCulture() });
    })   
}]);

